<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.prime.com.tr/ui">

    <body>
        
        <ui:composition template="./../Template/generalTemplate.xhtml">
          <ui:define name="content">
             <p:panel id="newCompany" header="Create New Company" style="height:495px;">
               <div style="margin-top:60px;margin-left:300px;">
                <h:form prependId="false">
                    <h:panelGrid id="grid" columns="3">
                        <h:outputText value="Company Name:*" />
                        <p:inputText  id="companyName" required="true" requiredMessage="Company Name Can not be Blank" value="#{createNewCompanyManagedBean.company.name}" />
                        <p:message for="companyName"  />

                        <h:outputText value="Company Address:*"/>
                        <p:inputText id="companyAddress" required="true" requiredMessage="Company Address Can not be Blank" value="#{createNewCompanyManagedBean.company.address}"/>
                        <p:message for="companyAddress"  />

                        <h:outputText value="Company Email:*"/>
                        <p:inputText id="email" required="true" requiredMessage="Company Email Can not be Blank" value="#{createNewCompanyManagedBean.company.email}">
                            <f:validator validatorId="company.managedbean.validation"/>
                        </p:inputText>
                        <p:message for="email" />

                          <h:outputText value="Contact Person:*"/>
                        <h:selectOneMenu id="title" required="true" requiredMessage="Please Select a Title" value="#{createNewCompanyManagedBean.company.contactPersonTitle}">
                            <f:selectItem itemLabel="Please select..." noSelectionOption="true"/>
                            <f:selectItem itemValue="Mr" itemLabel="Mr"/>
                            <f:selectItem itemValue="Mrs" itemLabel="Mrs"/>
                            <f:selectItem itemValue="Ms" itemLabel="Ms"/>
                        </h:selectOneMenu>
                          <p:message  for="title" />


                        <h:outputText value=""/>
                        <p:inputText id="contactPerson" required="true" requiredMessage="Contact Person Name Can not be Blank" value="#{createNewCompanyManagedBean.company.contactPersonName}"/>
                        <p:message for="contactPerson"/>


                        <h:outputText value="Contact Number:*"/>
                        <p:inputMask id="contactNumber" required="true" requiredMessage="Contact Number Can not be Blank" value="#{createNewCompanyManagedBean.company.contactNumber}" mask="(99)99999999"/>
                        <p:message for="contactNumber"/>

                        <h:outputText value="Company Type:*"/>
                        <h:selectOneMenu id="type" required="true" requiredMessage="Please Select Company Type" value="#{createNewCompanyManagedBean.company.companyType}">
                           <f:selectItem itemLabel="Please select..." noSelectionOption="true"/>
                           <f:selectItem itemValue="Direct Sales" itemLabel="Direct Sales"/>
                           <f:selectItem itemValue="Whole Sales" itemLabel="Whole Sales"/>
                        </h:selectOneMenu>
                        <p:message for="type"/>


                    </h:panelGrid>
                    <p:commandButton value="Save"  ajax="false"  update="grid" actionListener="#{createNewCompanyManagedBean.saveNewCompany}">
                        <f:attribute name="param1" value="Hello World!"/>
                    </p:commandButton>
                </h:form>
               </div>
             </p:panel>
          </ui:define>
        </ui:composition>
    </body>
</html>

